﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.IO;


namespace IssueTracker.Data
{
    public abstract class DataAccessComponent
    {
        protected T Clone<T>(T entity)
        {
            DataContractSerializer serializer = new DataContractSerializer(entity.GetType());

            MemoryStream memory = new MemoryStream();
            serializer.WriteObject(memory, entity);

            memory.Position = 0;

            T cloneCopy = (T)serializer.ReadObject(memory);
            memory.Close();

            return cloneCopy;
        }

    }
}
